package tech.yangzhijie.basic.java8;

import java.util.Arrays;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        method03();
    }

    public static void method01(){
        //格式1 无参数 无返回值
        Runnable r = () -> System.out.println("hello world");
        r.run();
    }

    public static void method02(){
        List<Employee> lists = Arrays.asList(
                new Employee("张三","武汉",6000,23),
                new Employee("李四","武汉",7000,22),
                new Employee("王五","武汉",8000,21),
                new Employee("赵六","武汉",9000,25)
                );
        /*lists.sort((x,y)->{
            if(x.getAge() != y.getAge()){
                return Integer.compare(x.getAge(),y.getAge());
            }else{
                return x.getName().compareTo(y.getName());
            }
        });*/

        lists.forEach(e -> System.out.println(e.getName()+"\t"+e.getAge()));
    }

    public static void method03(){
        String str = getValue("helloworld",x->"HelloWorld");
        System.out.println(str);
    }

    public static String getValue(String str, MyFunction my){
        return my.getValue(str);
    }
}
